Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@types/proj4

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/proj4

TypeScript definitions for proj4


Version published
Weekly downloads
69K
decreased by-65.09%
Maintainers
1
Install size
5.73 kB
Created
Weekly downloads
 

Package description

What is @types/proj4?

@types/proj4 provides TypeScript type definitions for the proj4 library, which is used for cartographic projections and coordinate transformations.

What are @types/proj4's main functionalities?

Coordinate Transformation

This feature allows you to transform coordinates from one projection system to another. In this example, coordinates in EPSG:4326 (WGS 84) are transformed to EPSG:3857 (Web Mercator).

const proj4 = require('proj4');
const firstProjection = 'EPSG:4326';
const secondProjection = 'EPSG:3857';
const coordinates = [2.2945, 48.8584];
const transformedCoordinates = proj4(firstProjection, secondProjection, coordinates);
console.log(transformedCoordinates);

Defining Custom Projections

This feature allows you to define custom projections. In this example, a custom UTM projection is defined and then used to transform coordinates to EPSG:4326.

const proj4 = require('proj4');
const customProjection = '+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs';
proj4.defs('EPSG:32633', customProjection);
const coordinates = [500000, 4649776.22482];
const transformedCoordinates = proj4('EPSG:32633', 'EPSG:4326', coordinates);
console.log(transformedCoordinates);

Batch Transformations

This feature allows you to perform batch transformations on an array of coordinates. In this example, an array of coordinates in EPSG:4326 is transformed to EPSG:3857.

const proj4 = require('proj4');
const firstProjection = 'EPSG:4326';
const secondProjection = 'EPSG:3857';
const coordinatesArray = [[2.2945, 48.8584], [13.4050, 52.5200]];
const transformedCoordinatesArray = coordinatesArray.map(coords => proj4(firstProjection, secondProjection, coords));
console.log(transformedCoordinatesArray);

Other packages similar to @types/proj4

Readme

Source

Installation

npm install --save @types/proj4

Summary

This package contains type definitions for proj4 (https://github.com/proj4js/proj4js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/proj4.

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: none

Credits

These definitions were written by Denis Carriere, and BendingBender.

FAQs

Last updated on 07 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc